/**
 * Copyright (c) 2016-2021 by the respective copyright holders.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 */
package com.zsmartsystems.zigbee.dongle.ember.ezsp.structure;

import java.util.HashMap;
import java.util.Map;

/**
 * Class to implement the Ember Enumeration <b>EmberLibraryId</b>.
 * <p>
 * The Ember library identifier.
 * <p>
 * Note that this code is autogenerated. Manual changes may be overwritten.
 *
 * @author Chris Jackson - Initial contribution of Java code generator
 */
public enum EmberLibraryId {
    /**
     * Default unknown value
     */
    UNKNOWN(-1),

    /**
     * Zigbee Pro
     */
    EMBER_ZIGBEE_PRO_LIBRARY(0x0000),

    /**
     * Binding
     */
    EMBER_BINDING_LIBRARY(0x0001),

    /**
     * End Device Bind
     */
    EMBER_END_DEVICE_BIND_LIBRARY(0x0002),

    /**
     * Security Core
     */
    EMBER_SECURITY_CORE_LIBRARY(0x0003),

    /**
     * Security Link Keys
     */
    EMBER_SECURITY_LINK_KEYS_LIBRARY(0x0004),

    /**
     * Alarms
     */
    EMBER_ALARM_LIBRARY(0x0005),

    /**
     * CBKE 163K1
     */
    EMBER_CBKE_LIBRARY(0x0006),

    /**
     * CBKE DSA Sign
     */
    EMBER_CBKE_DSA_SIGN_LIBRARY(0x0007),

    /**
     * ECC
     */
    EMBER_ECC_LIBRARY(0x0008),

    /**
     * CBKE DSA Verify
     */
    EMBER_CBKE_DSA_VERIFY_LIBRARY(0x0009),

    /**
     * Packet Validate
     */
    EMBER_PACKET_VALIDATE_LIBRARY(0x000A),

    /**
     * Install Code
     */
    EMBER_INSTALL_CODE_LIBRARY(0x000B),

    /**
     * ZLL
     */
    EMBER_ZLL_LIBRARY(0x000C),

    /**
     * CBKE 283K1
     */
    EMBER_CBKE_LIBRARY_283K1(0x000D),

    /**
     * ECC 283K1
     */
    EMBER_ECC_LIBRARY_283K1(0x000E),

    /**
     * CBKE core
     */
    EMBER_CBKE_CORE_LIBRARY(0x000F),

    /**
     * NCP
     */
    EMBER_NCP_LIBRARY(0x0010),

    /**
     * Multi network
     */
    EMBER_MULTI_NETWORK_LIBRARY(0x0012),

    /**
     * Enhanced Beacon Request
     */
    EMBER_ENHANCED_BEACON_REQUEST_LIBRARY(0x0013),

    /**
     * CBKE 283K1 DSA Verify
     */
    EMBER_CBKE_283K1_DSA_VERIFY_LIBRARY(0x0014);

    /**
     * A mapping between the integer code and its corresponding type to
     * facilitate lookup by code.
     */
    private static Map<Integer, EmberLibraryId> codeMapping;

    private int key;

    static {
        codeMapping = new HashMap<Integer, EmberLibraryId>();
        for (EmberLibraryId s : values()) {
            codeMapping.put(s.key, s);
        }
    }

    private EmberLibraryId(int key) {
        this.key = key;
    }

    /**
     * Lookup function based on the EmberStatus type code. Returns null if the
     * code does not exist.
     *
     * @param code the code to lookup
     * @return enumeration value of the alarm type.
     */
    public static EmberLibraryId getEmberLibraryId(int code) {
        if (codeMapping.get(code) == null) {
            return UNKNOWN;
        }

        return codeMapping.get(code);
    }

    /**
     * Returns the EZSP protocol defined value for this enumeration.
     *
     * @return the EZSP protocol key
     */
    public int getKey() {
        return key;
    }
}
